<?php

declare(strict_types=1);

namespace app\agent\controller\order;

use app\agent\controller\Controller;
use app\model\CouponOrder;
use think\Request;

/**
 * @apiDefine oilAdmin 管理后台
 */
class Coupon extends Controller
{
    public function list(Request $request)
    {
        $data = input('post.');
        $data['agent_id'] = $this->agent['id'];
        if (!empty($data['is_export'])) {
            return CouponOrder::getAgentList($data);
        }

        $list = CouponOrder::getAgentList($data);
        return success('操作成功', $list);
    }

    /**
     * 权益订单列表
     * @return \think\response\Json|void
     */
    public function couponOrderList() {

        $data = input('post.');
        $data['agent_id'] = $this->agent['id'];
        $data['platform'] = CouponOrder::C_PLATFORM_AGENT;
        $couponOrderModel = new CouponOrder();
        $list = $couponOrderModel->couponOrderList($data);
//        if ($list['status']) {
//            return success('操作成功', $list['data']);
//        }
//        $msg = $list['msg'] ?? '操作失败';
        return $list;
    }

}
